home *** CD-ROM | disk | FTP | other *** search
- * ***
- * Graphics functions test
- *
- * Julian Barkway (c) September 1994 All rights reserved.
- * ***
- Class GraphicsTest GraphicsPane win ls le c
-
- Methods GraphicsTest 'all'
- new | maxW maxH |
- maxW <- (smalltalk getMaxScreenArea) right.
- maxW <- 200 min: (maxW - 50).
- maxH <- (smalltalk getMaxScreenArea) bottom.
- maxH <- 200 min: (maxH - 50).
- win <- Window new;
- title: 'Graphics Test';
- openAt: (20@60) withSize: (maxW@maxH).
- super new;
- boundsFrom: (-1 @ -1) to: ((win size) + (1 @ 1));
- attachTo: win withSizing: (1 @ 1).
- |
- draw
- self startDrawing.
- self drawCircle.
- self drawLine.
- self drawRects.
- self endDrawing
- |
- drawCircle
- c <- Circle new;
- center: (100@100);
- radius: 50.
- c frame.
- (c center) drawPixel
- |
- drawLine
- ls <- (c center) - (c radius).
- ls moveTo.
- le <- (c center) + (c radius).
- le y: (le y) + 20.
- le lineTo.
- |
- drawRects | r r2 |
- r <- Rectangle new;
- upperLeft: ((ls x)@((le y) - ((c radius * 2) + 30)));
- bottomRight: ((le x)@((le y) - (c radius * 2)));
- frame.
- r inset: (4@4).
- r invert.
- r2 <- Rectangle new;
- upperLeft: (r upperLeft) - 40;
- bottomRight: (r upperLeft) - 10;
- frame;
- shade: 30;
- paint;
- shade: 100.
- r2 inset: (6@4).
- r2 erase
- ]
-